package test

import (
	"GoKill/models"
	"github.com/gin-gonic/gin"
	"strconv"
)

func Ping(c *gin.Context) {
	c.JSON(200, gin.H{
		"message": "pong",
	})
}

func SaveProInRedis(c *gin.Context) {
	var productList []models.Product
	models.DB.Find(&productList)
	for i := 0; i < len(productList); i++ {
		models.RDB.Set(c, "product:"+strconv.Itoa(int(productList[i].ID)), productList[i].ProductNum, 0)
	}
}
